package trangle;

import java.util.Scanner;

/**
 * Created by hps on 17-4-30.
 */
public class TrangleApp {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("Enter a number: ");
        int n = scanner.nextInt();
        int result = trangle(n);
        System.out.println("Triangle = " + result);
    }

    public static int trangle(int n) {
        if(n == 1)
            return 1;
        return n + trangle(n - 1);
    }
}
